Skip to content

nextflow plugins -help: show subcommands#7197

Open
ewels wants to merge 3 commits into
masterfrom
subcommand-help
Open

nextflow plugins -help: show subcommands#7197
ewels wants to merge 3 commits into
masterfrom
subcommand-help

Conversation

@ewels
Copy link
Copy Markdown
Member

@ewels ewels commented Jun 2, 2026

Show the available subcommands for nextflow plugins in the CLI help.

Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 2, 2026

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 81db3ae
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/6a244ed7b31c550008517765

void run() {
if( !args )
throw new AbortOperationException("Missing plugin command - usage: nextflow plugin install <pluginId,..>")
if( !args ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should print the reason of the failure before printing the usage

result << ''
break
default:
throw new AbortOperationException("Unknown plugin sub-command: ${args[0]}")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default branch aborts on the <plugin-name>:<command> form, which is the third invocation advertised in the top-level help just above (and arguably the primary purpose of nextflow plugin).

For example nextflow plugin nf-hello:greet -help parses args = ['nf-hello:greet'], command.help is set, so Launcher.checkForHelp() calls usage()usage(args). args[0] is neither install nor create, so this default throws Unknown plugin sub-command: nf-hello:greet — i.e. asking for help on a documented, valid invocation produces an error claiming it does not exist. (Execution in run() is fine — it handles the : form via args[0].contains(CMD_SEP); only the usage path aborts.)

Suggest falling back to general usage for the : form rather than aborting:

default:
    if( args[0].contains(CMD_SEP) ) {
        result << 'Execute a plugin-specific command'
        result << 'Usage: nextflow plugin <plugin-name>:<command> [args]'
        result << ''
        result << 'See the documentation of the individual plugin for its available commands.'
        result << ''
    }
    else {
        throw new AbortOperationException("Unknown plugin sub-command: ${args[0]}")
    }

This keeps the genuine typo error (e.g. nextflow plugin instal -help) while not blowing up on the legitimate plugin-command form. Worth a test pinning the behavior down.

Address review feedback on the plugin usage help:

- The usage() default branch aborted on the <plugin-name>:<command>
  form, so `nextflow plugin nf-hello:greet -help` errored claiming the
  command was unknown. It now falls back to a plugin-specific usage
  block for the colon form (pditommaso).
- For a genuine unknown sub-command, print the failure reason before
  the general usage rather than a bare abort (jorgee).
- Add CmdPluginUsageTest pinning the usage output for each case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
@ewels
Copy link
Copy Markdown
Member Author

ewels commented Jun 6, 2026

Addressed the review feedback in 81db3ae:

  • usage() no longer aborts on the <plugin-name>:<command> form — it now shows a plugin-specific usage block, so nextflow plugin nf-hello:greet -help works as documented (@pditommaso).
  • For a genuine unknown sub-command, the failure reason is now printed before the general usage instead of a bare abort (@jorgee).
  • Added CmdPluginUsageTest pinning the output for each case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants